/* ========================================================================== */
/*   ReadLogHandler.h    		                                              */
/*   (c) 2012 Team 7 Hogeschool Utrecht ICT TI                                */
/*		Lars Stolwijk, Gerben Boot, Guido van Hienen, Marcel Boelen			  */
/*                                                                            */
/* 	 Communicates with the log and receives signals from the IRSensor. Sends  */
/*		the data from the Log to the ReadLogController for further process.   */
/* ========================================================================== */

#ifndef __ReadLogHandler
#define __ReadLogHandler

#include "pRTOS.h"
#include "LogFile.h"
#include "SoundController.h"
#include "ReadLogController.h"

class Log;
class SoundController;
class ReadLogController;

class ReadLogHandler : public RTOS::task {
	public:	
		//Constructor
		ReadLogHandler(int prio, SoundController * soundController) : RTOS::task(prio, "ReadLogHandlerTask"), theSoundController(soundController),readLogController(new ReadLogController), ReadLogFlag(this, "ReadLogFlag"), LogMailbox("LogMailbox"){};
		
		void RegisterLog(Log * log);
		void ReadLog();
		void WriteLog(LogLine arr[]);
		
	private:
		SoundController * theSoundController;
		Log * theLog;
		LogFile file;
		
		ReadLogController * readLogController;
		RTOS::flag ReadLogFlag;
		RTOS::mailbox<LogFile*> LogMailbox;	

		void main();
};

#endif
